/*
 * VideoStreamingLinuxApp.java
 */

package videostreaminglinux;

import javax.bluetooth.UUID;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

/**
 * The main class of the application.
 *
 * @author Jiri Masek, masekj5
 */
public class VideoStreamingLinuxApp extends SingleFrameApplication {

    // Shared UUID by server and client
    public static final UUID RFCOMM_UUID = new UUID(0x0003);

    public static final byte[] intToByteArray(int value) {
        return new byte[] { (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) value };
    }

    public static final int byteArrayToInt(byte[] b) {
        return (b[0] << 24) + ((b[1] & 0xFF) << 16) + ((b[2] & 0xFF) << 8) + (b[3] & 0xFF);
    }

    /**
     * At startup create and show the main frame of the application.
     */
    @Override protected void startup() {
        show(new VideoStreamingLinuxView(this));
    }

    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     */
    @Override protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of VideoStreamingLinuxApp
     */
    public static VideoStreamingLinuxApp getApplication() {
        return Application.getInstance(VideoStreamingLinuxApp.class);
    }

    /**
     * Main method launching the application.
     */
    public static void main(String[] args) {
        launch(VideoStreamingLinuxApp.class, args);
    }
}
